package com.jiepu.daily.corejava.advanceed.part7network.day0812;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

/**
 * @Description:
 * @author: xinjie
 * @date: 2020/8/12  10:58
 */
public class ChatClient2 {
	public static void main(String[] args) {
		final String ip = "localhost";
		final int port = 8888;
		try {
			Socket socket = new Socket(ip, port);
			System.out.println("Client连接成功");



			System.out.println();
			System.out.println("输出流 ");
			OutputStream os = socket.getOutputStream();
			System.out.println("Clinet say :");
			Scanner scanner = new Scanner(System.in);
			String msg = scanner.nextLine();
			os.write(msg.getBytes());
			os.flush();


		} catch (IOException e) {
			e.printStackTrace();
		}

	} // main
}
